Skip to content

Conversation

@paula-stacho
Copy link
Collaborator

@paula-stacho paula-stacho commented Jul 9, 2025

Description

This was broken when during the reflux -> redux rewrite, I missed to call the callbacks. Added tests so that this is covered for the next person.
With this change, adding a geoLayer works, unfortunately the edit & delete are just never triggered by react-leaflet-draw. I will create a separate ticket to update the leaflet libraries, which are on very old versions (but we can't go to the newest with react 17)

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings July 9, 2025 12:45
@paula-stacho paula-stacho requested a review from a team as a code owner July 9, 2025 12:45
@github-actions github-actions bot added the fix label Jul 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes missing callbacks for geoLayers actions in the schema store and adds tests to ensure those callbacks are invoked correctly.

  • Updated geoLayerAdded, geoLayersEdited, and geoLayersDeleted to accept and call callbacks with the generated geo query.
  • Added unit tests in store.spec.ts to verify each callback is invoked with the correct query shape.
  • Imported Circle, LayerGroup, and Polygon in tests to construct layer examples.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/compass-schema/src/stores/store.spec.ts Added tests for geoLayerAdded, geoLayersEdited, geoLayersDeleted callbacks and imported Leaflet types.
packages/compass-schema/src/stores/schema-analysis-reducer.ts Updated geoLayers action creators to accept onAdded/onEdited/onDeleted callbacks and invoke them with generateGeoQuery instead of returning it.
Comments suppressed due to low confidence (2)

packages/compass-schema/src/stores/schema-analysis-reducer.ts:154

  • Add or update JSDoc comments for geoLayerAdded, geoLayersEdited, and geoLayersDeleted to document the new callback parameters (onAdded, onEdited, onDeleted), explaining when and with what arguments they are invoked.
export const geoLayerAdded = (

packages/compass-schema/src/stores/schema-analysis-reducer.ts:183

  • [nitpick] Each call to geoLayerAdded within geoLayersEdited still executes generateGeoQuery for every intermediate layer, even though those results are discarded; consider extending geoLayerAdded to accept an option to batch updates or skip intermediate callbacks to avoid unnecessary query generation.
        geoLayerAdded(field, layer, () => {

@paula-stacho paula-stacho merged commit 3015e57 into main Jul 10, 2025
102 of 106 checks passed
@paula-stacho paula-stacho deleted the COMPASS-9540 branch July 10, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants